import numpy as np
import pandas
import pandas as pd

# 创建Series
# data = [100,90,80,70,60]
# s = pd.Series(data,index=['zs','li','wu','ll','qq'])
# print(s)

#  数据分为数值型和类别型,使用字典创建指定索引会重新创建索引和NAN
# data = {'s101':'zs','s102':'ls'}
# s = pd.Series(data)
# print(s)

# 生成10个由0.2组成的数组
# ary = np.zeros(10)+0.1
# ary = np.ones(10) / 5

# s = pandas.Series(0.2,index=range(10))
# print(s)

# 访问Series中的数据
s = pd.Series([100,90,80],index=['zs','ls','wu'])
# series中，有2套索引：位置索引，标签索引
# print(s[0])
# print(s[0:2])
# print(s[[0,2]])

# print(s['zs'])
# print(s['zs':'ls']) #包含最后一个
# print(s[['zs','wu']])

print(s.values,type(s))
print(s.dtype)
print(s[s.index[:2]])